<template>
  <div class="app-container">
    <el-form :inline="true" ref="ruleForm" :model="formInline" class="demo-form-inline">

      <el-form-item prop="time" label="到账时间">
        <el-date-picker
          v-model="formInline.time"
          type="datetimerange"
          align="right"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          :default-time="['00:00:00', '23:59:59']"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd HH:mm:ss"
          :picker-options="pickerDayStep">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="到账金额">
        <el-col :span="11">
          <el-form-item prop="money_start">
            <el-input @keyup.enter.native="$emit('on-filter',formInline)" v-model="formInline.money_start" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col class="line" :span="2">至</el-col>
        <el-col :span="11">
          <el-form-item prop="money_end">
            <el-input @keyup.enter.native="$emit('on-filter',formInline)" v-model="formInline.money_end" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
      </el-form-item>
      <el-form-item label="附言" prop="postscript">
        <el-input @keyup.enter.native="$emit('on-filter',formInline)" v-model="formInline.postscript" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item label="付款人" prop="account">
        <el-input @keyup.enter.native="$emit('on-filter',formInline)" v-model="formInline.account" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select v-model="formInline.status" placeholder="请选择状态">
          <el-option
            v-for="item in consts.EXCEPTION_STATUS"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="审核人" prop="auditter">
        <el-select v-model="formInline.auditter" placeholder="请选择审核人">
          <el-option
            v-for="(item, index) in auditAuditterList.list"
            :label="item.operator"
            :key="index"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="$emit('on-filter',formInline)">搜索
      </el-button>
      <el-button @click="selfResetForm('ruleForm')">重置</el-button>
    </el-form>
  </div>

</template>

<script>

// services
import { getExceptionRechargeAuditterList } from '@/services/api/recharge';

// mixins
import { form, grid, pickerOption } from '@/build';

export default {
  name: 'form-exceptions-filter',
  mixins: [form, grid, pickerOption],
  model: {
    prop: 'formInline',
    event: 'change',
  },
  data() {
    return {
      auditAuditterList: {
        list: [],
      },
      formInline: {
        time: [moment().format('YYYY-MM-DD 00:00:00'), moment().format('YYYY-MM-DD 23:59:59')],
        money_start: undefined,
        money_end: undefined,
        status: undefined,
        auditter: undefined,
        level: '',
        keywords: '',
        scope: '',
        timeScope: '',
      },

    };
  },
  methods: {
    selfResetForm(formName) {
      this.resetForm(formName);
      this.$parent.getAll();
    },
  },
  mounted() {
    this.bindGet(getExceptionRechargeAuditterList, 'auditAuditterList', {});
    this.getAll();
  },
};
</script>

<style lang="scss" scoped>
  .with-pre-select {
    .el-input-group__prepend {
      .el-select {
        width: 120px;
      }
    }
  }

  .money-range {
    .el-input {
      width: 100px;
    }
  }

</style>
